Skip to content

DOC: update the to_json() docstring #20149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

robmarkcole
Copy link
Contributor

@robmarkcole robmarkcole commented Mar 10, 2018

Fixes validation errors and adds an example for each orientation.

  • [ x] PR title is "DOC: update the docstring"
  • [ x] The validation script passes: scripts/validate_docstrings.py <your-function-or-method>
  • [ x] The PEP8 style check passes: git diff upstream/master -u -- "*.py" | flake8 --diff
  • [x ] The html version looks good: python doc/make.py --single <your-function-or-method>
  • [x ] It has been proofread on language by another sprint participant
Errors found:
	Missing description for See Also "pandas.read_json" reference
	Examples do not pass tests

I'm not able to make this pass.

Fixes validation errors and adds an example for each orientation
@robmarkcole
Copy link
Contributor Author

@samuelsinayoko
@gioiab

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Added an inline comment. And two additional ones:

  • In the See Also section, can you change pd.read_json to pandas.read_json ?
  • In the "Parameters" section, in the description of the 'orient', in the bullet point "The format of the JSON string", can you quote the options? (so eg - 'split': ... instead of - split: ...), to make it clear it are strings that needs to be passed.

@@ -1665,8 +1665,9 @@ def to_json(self, path_or_buf=None, orient=None, date_format=None,
Parameters
----------
path_or_buf : the path or buffer to write the result string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "the path or buffer to write the result string" is actually the explanation, so should go on the next line. On this line comes the type description, you can take a look at eg DataFrame.to_csv how this is typically explained.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers

Copy link
Contributor Author

@robmarkcole robmarkcole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jorisvandenbossche pandas.read_json also gives an error I'm afraid, but it is consistent with the other docstrings

@@ -1665,8 +1665,9 @@ def to_json(self, path_or_buf=None, orient=None, date_format=None,
Parameters
----------
path_or_buf : the path or buffer to write the result string
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers

Adds quotes in parameters and updates path_or_buf to match to_csv
@codecov
Copy link

codecov bot commented Mar 13, 2018

Codecov Report

Merging #20149 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #20149      +/-   ##
==========================================
+ Coverage   91.72%   91.76%   +0.03%     
==========================================
  Files         150      150              
  Lines       49156    49148       -8     
==========================================
+ Hits        45090    45099       +9     
+ Misses       4066     4049      -17
Flag Coverage Δ
#multiple 90.14% <100%> (+0.03%) ⬆️
#single 41.9% <100%> (+0.04%) ⬆️
Impacted Files Coverage Δ
pandas/core/generic.py 95.85% <100%> (+0.01%) ⬆️
pandas/core/base.py 96.78% <0%> (-0.02%) ⬇️
pandas/core/algorithms.py 94.17% <0%> (-0.01%) ⬇️
pandas/core/window.py 96.3% <0%> (-0.01%) ⬇️
pandas/core/series.py 93.85% <0%> (-0.01%) ⬇️
pandas/core/indexes/base.py 96.66% <0%> (-0.01%) ⬇️
pandas/core/indexes/datetimes.py 95.64% <0%> (ø) ⬆️
pandas/core/groupby.py 92.14% <0%> (ø) ⬆️
pandas/core/strings.py 98.32% <0%> (ø) ⬆️
pandas/core/indexes/timedeltas.py 91.03% <0%> (ø) ⬆️
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 840d432...579532a. Read the comment docs.

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a small edit of some quotes, and removed the return statement (was already there, but actually wrong)

@jorisvandenbossche jorisvandenbossche merged commit fc42e6e into pandas-dev:master Mar 13, 2018
@jorisvandenbossche
Copy link
Member

@robmarkcole Thanks for the PR!

@jorisvandenbossche jorisvandenbossche added this to the 0.23.0 milestone Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants